//assign w
wn=w/norm(w,1);
mtf=0;
tdf=zeros(1,3);
ptf=0;
for i=1:ngen+1
    epls=gepls(i).entries;
    gsize=ggsize(i);
    grid=ggrid(i).entries;
    pact=gpact(i).entries;
    plo=genpls2(wn,1);
    s2=atos2(plo);
    s1=zeros(3*gsize,1);
    s=0;
    s3=zeros(3*gsize,1);
    for j=1:3*gsize-1
        a2=plo(s+1,j);
        a=epls(s+1,j);
        s3(j+1)=s+a2;
        s=s+a;
        s1(j+1)=s;
    end
    mtch=sum(s1==s2)/(3*gsize)*100;
    pmtch=sum(s1==s3)/(3*gsize)*100;
    ptf=ptf+pmtch;
    mtf=mtch+mtf;
    //find match percentage
    fs1=evalr2(epls);
    fs2=evalr2(plo);
    df=abs(fs1-fs2)/gsize;
    tdf=tdf+df;
//    pc=df./(abs(fs1));
//    pc=1.-pc;
//    avp=sum(pc)/3*100;
    //find reward match percentage
end
mtf=mtf/(ngen+1);
tdf=tdf/(ngen+1);
ptf=ptf/(ngen+1);
